

package exam;

public class StudentResult {
    private String Full_Name, Exam_Name, Exam_Score, Exam_Grade;
    
    StudentResult(){
        Full_Name = "No Name";
        Exam_Name = "Unknown";
        Exam_Score = "No Statistic";
        Exam_Grade = "No Record";
    }
    
    String fullName(String aName){
        Full_Name = aName;
        return Full_Name;
    }
    
    String examName(String examcode){
        switch(examcode){
            case "VB":
                Exam_Name = "Visual Basic .NET";
                break;
            case "JV":
                Exam_Name = "Java";
                break;
            case "C#":
                Exam_Name = "C# .NET";
                break;
            case "PHP":
                Exam_Name = "PHP";
                break;
            default:
                Exam_Name = "No Exam Selected";                
        }
        return Exam_Name;
    }
    
    String examScore(int aScore){
        Exam_Score = aScore + "out of 50";
        return Exam_Score;
    }
    
    String examGrade(int aScore){
        Exam_Grade = this.getGrade(aScore);
        return Exam_Grade;
    }
    
    private String getGrade(int aScore){
        String examGrade = "";
        
        if ((aScore>=0) && (aScore<=10)){
            examGrade = "E";
        }
        else if ((aScore>=11) && (aScore<=20)){
            examGrade = "D";
        }
        else if ((aScore>=21) && (aScore<=30)){
            examGrade = "C";
        }
        else if ((aScore>=31) && (aScore<=40)){
            examGrade = "B";
        }
        else if ((aScore>=40) && (aScore<=50)){
            examGrade = "A";
        }
        else{
            examGrade = "Invalid Score"; 
        }
        return "Grade is " + examGrade;     
    }
}

